package com.wangijun.yuan.web.api;


import com.wangijun.yuan.web.base.CommonPage;
import com.wangijun.yuan.web.base.CommonResult;
import com.wangijun.yuan.core.model.IdParam;
import com.wangijun.yuan.web.model.dto.*;
import com.wangijun.yuan.web.model.vo.MainArticleVO;
import com.wangijun.yuan.web.model.vo.TagInfoVO;
import com.wangijun.yuan.web.model.vo.TopicInfoVO;
import com.wangijun.yuan.web.model.vo.UserInfoVO;
import com.wangijun.yuan.web.service.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "9-个人中心接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/personal")
public class PersonalController {
    private final PersonService personService;
    private final ArticleService articleService;
    private final TagInfoService tagInfoService;
    private final TopicInfoService topicInfoService;
    private final UserService userService;

    @Operation(summary = "用户信息查询")
    @PostMapping("/user")
    CommonResult<UserInfoVO> userInfo(@RequestBody IdParam param) {
        return CommonResult.data(personService.userInfo(param.getId()));
    }


    @Operation(summary = "查看用户相关的文章")
    @PostMapping("/article")
    CommonResult<CommonPage<MainArticleVO>> personalArticle(@RequestBody PersonalArticleParam param) {
        return CommonResult.data(articleService.personalArticleList(param));
    }

    @Operation(summary = "查看用户关注列表或粉丝列表")
    @PostMapping("/user-list")
    CommonResult<CommonPage<UserInfoVO>> personalUser(@RequestBody PersonalUserParam param) {
        return CommonResult.data(userService.personalUserList(param));
    }

    @Operation(summary = "查看用户关注标签列表")
    @PostMapping("/follow-tag")
    CommonResult<CommonPage<TagInfoVO>> followTag(@RequestBody PersonalTagParam param) {
        return CommonResult.data(tagInfoService.followTag(param));
    }

    @Operation(summary = "查看用户关注话题列表")
    @PostMapping("/follow-topic")
    CommonResult<CommonPage<TopicInfoVO>> followTopic(@RequestBody PersonalTopicParam param) {
        return CommonResult.data(topicInfoService.followTopic(param));
    }

    @Operation(summary = "查询用户列表")
    @PostMapping("/qry-user")
    CommonResult<CommonPage<UserInfoVO>> qryUser(@RequestBody QryUserParam param) {
        return CommonResult.data(userService.qryUser(param));
    }

    @Operation(summary = "查询标签列表")
    @PostMapping("/qry-tag")
    CommonResult<CommonPage<TagInfoVO>> qryTag(@RequestBody QryTagParam param) {
        return CommonResult.data(tagInfoService.qryTag(param));
    }

    @Operation(summary = "查询话题列表")
    @PostMapping("/qry-topic")
    CommonResult<CommonPage<TopicInfoVO>> qryTopic(@RequestBody QryTopicParam param) {
        return CommonResult.data(topicInfoService.qryTopic(param));
    }



    @Operation(summary = "查看点赞的评论")
    @PostMapping("/liked-comment")
    CommonResult<Boolean> likedComment(@RequestBody PersonalArticleParam param) {
        return CommonResult.ok();
    }

    @Operation(summary = "查看评论的文章")
    @PostMapping("/comment-article")
    CommonResult<Boolean> commentArticle(@RequestBody PersonalArticleParam param) {
        return CommonResult.ok();
    }
}
